<?php
//
//  Utils
//
//  Created by Jules Bernable on 2007-07-19.
//  Copyright (c) 2007  __LaForceMolle__. All rights reserved.
//
//
//
class Utils {
	//
	/********************************************************************************
	*********************************** Methodes ************************************
	********************************************************************************/
	//
	function loadFunction($function){
        // Multiple
        if (is_array($function)){
            $res = array();
            foreach ($function as $singlefunc){
                $res[$singlefunc] = Utils::loadFunction($singlefunc);
            }
            return $res;
        }
        // Check for packages which can modify the function table at runtime
        $symbolfuncs = array('rename_function', 'runkit_rename_function');
        foreach ($symbolfuncs as $symbolfunc) {
            $renamedfunction = 'utils_renamed' . $function;
            if (function_exists($symbolfunc) && function_exists($function) && !function_exists($renamedfunction)){
                // Rename the core function
                rename_function($function, $renamedfunction);
                break;
        	}
	        // Single
	        if (!function_exists($function)) {
	            $file = sprintf('org/forcemolle/utils/function/%s.php', $function);
	            if((@require_once $file) !== false) {
	                return true;
	            }
	        }
		}
        return false;
    }
	//
	function loadConstant($constant){
        // Multiple
        if (is_array($constant)) {
            $res = array();
            foreach ($constant as $singleconst) {
                $res[$singleconst] = PHP_Compat::loadConstant($singleconst);
            }
            return $res;
        }
        // Single
        $file = sprintf('org/forcemolle/utils/constant/%s.php', $constant);
        if ((@require_once $file) !== false) {
            return true;
        }
        return false;
    }
	//
}
?>